/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tool;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JButton;

/**
 *
 * @author Administrator
 */
public class CrossCloseButton extends JButton {

        private final int size = 10;
        private final int border = 2;

        public CrossCloseButton() {
            super();
            setContentAreaFilled(false);
            setFocusable(false);
            setBorderPainted(false);
            setToolTipText("Click here to close this tab");
        }

    @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.BLUE);
            g.drawLine(border, border, getWidth() - border - 1, getHeight() - border - 1);
            g.drawLine(getWidth() - border - 1, border, border, getHeight() - border - 1);
        }

    @Override
        public Dimension getPreferredSize() {
            return new Dimension(size, size);
        }
    }